Dynamic route profile storage in a hardware trie routing table

ABSTRACT

The present disclosure involves systems and methods for managing a trie routing table for a networking device of a communication or computer network. In one implementation, the networking device may utilize a dynamic algorithm for associating hashing functions with pivot tiles of the routing table to improve hash utilization and avoid hash collisions. Further, route prefixes may be relocated from pivot tiles in an attempt to free the tiles for reallocation to other prefix base width or may be relocated to other possible pivot tiles or to a general storage space when a hash collision is detected. This provides for even distribution of pivots within tiles which have base widths in range of a pivot route. The above implementations may occur together or separately to improve the operation of the networking device and provide faster route lookup.

TECHNICAL FIELD

The present disclosure relates generally to communication networks, and more specifically to IP (Internet Protocol) address storage and lookup for use in transmission of network traffic.

BACKGROUND

Telecommunication networks, or other types of computer networks, provide for the transmission of information across some distance through terrestrial, wireless or satellite communication networks and devices. Such communications may involve voice, data or multimedia information, among others. In general, devices of the network may include methods, components, circuits, programs, etc. to look up a destination Internet Protocol (IP) address of a received packet in an address table to determine how the packet should be routed to the next device in the network or through the entire network to the destination. Upon accessing the address table, the device may perform a longest prefix match on the destination address against a prefix table containing a large number of entries accessible by the device. In many cases, this occurs at a very high speed. After the match is identified, the corresponding information is used to forward the packet to the next device in the network such that the packet may be directed toward the destination device.

BRIEF DESCRIPTION OF THE DRAWINGS

The above-recited and other advantages and features of the disclosure will become apparent by reference to specific embodiments thereof which are illustrated in the appended drawings. Understanding that these drawings depict only example embodiments of the disclosure and are not therefore to be considered to be limiting of its scope, the principles herein are described and explained with additional specificity and detail through the use of the accompanying drawings in which:

FIG. 1 is a system diagram of an example network architecture;

FIG. 2 is a schematic diagram of a pivot, trie, and next-hop tiles for use in performing a route lookup of a networking device;

FIG. 3 is a flowchart of a method for dynamic storage of routing prefixes in a pivot tile of a networking device;

FIG. 4 is a flowchart of a method for adding a prefix in a dynamic trie structure of a networking device;

FIG. 5 is a flowchart of a method for dynamic hash allocation of pivot tiles for efficient hash utilization in a network device;

FIG. 6 is a diagram illustrating application of the dynamic hash allocation in a plurality of pivot tiles of a networking device;

FIG. 7 is a flowchart of a method for regrouping pivot tiles of a network device to free up one or more tiles in a networking device;

FIG. 8 is a diagram illustrating regrouping of pivot tiles of a network device to efficiently allocate different base widths of the pivot tiles;

FIGS. 9A and 9B illustrate a flowchart of a method for relocating prefixes when a hash collision occurs within the pivot tile of the networking device; and

FIG. 10 shows an example system embodiment.

DESCRIPTION OF EXAMPLE EMBODIMENTS

Various embodiments of the disclosure are discussed in detail below. While specific implementations are discussed, it should be understood that this is done for illustration purposes only. A person skilled in the relevant art will recognize that other components and configurations may be used without parting from the spirit and scope of the disclosure.

Overview:

A system, network device, method, and/or computer readable storage medium is disclosed for managing a routing table of a networking device. Managing the routing table may include maintaining a plurality of pivot tiles in memory for storing pivot entries each comprising a plurality of received route prefixes of a routing table, each of the plurality of pivot tiles associated with a hash function and a prefix base width and selecting a first of the plurality of pivot tiles for grooming. Grooming the first of the plurality of pivot tiles may include relocating at least a first pivot entry from the first of the plurality of pivot tiles to a Ternary Content-Addressable Memory (TCAM), moving at least a second pivot entry from the first of the plurality of pivot tiles to a second of the plurality of pivot tiles, and returning the first of the plurality of pivot tiles to a shared pool of pivot tiles for reallocation when the plurality of received route prefixes of the routing table stored in the first of the plurality of pivot tiles are removed

Other implementations include dynamically associating a first hash function with the first of the plurality of pivot tiles and a second hash function with the second of the plurality of pivot tiles, the first hash function different than the second hash function, and wherein the first hash function provides a storage location within the first of the plurality of pivot tiles based at least on a portion of a prefix to be stored in the first of the plurality of pivot tiles. Selecting the first hash function for the first of the plurality of pivot tiles may be based at least on a distribution of each hash function for the plurality of pivot tiles.

In still other implementations may include detecting a hash collision at the location for the second pivot entry in the second of the plurality of the pivot tiles between the second pivot entry and an occupying pivot entry of the second of the plurality of the pivot tiles. Upon the collision, the method may copy the occupying pivot entry of the second of the plurality of the pivot tiles to the TCAM or to a third of the plurality of pivot tiles and relocating the second pivot entry to the location for the second pivot entry in the second of the plurality of the pivot tiles.

Example Embodiments

Aspects of the present disclosure involve systems and methods for managing a trie routing table for a networking device of a communication or computer network. In one implementation, the networking device may utilize a dynamic algorithm for associating hashing functions with pivot tiles of the routing table. The dynamic hash type selection algorithm may operate to maximize or improve the hash utilization within the routing table to avoid hash collisions upon entry of additional route prefixes to the table. In other implementations, pivots or prefixes may be relocated from pivot tiles in an attempt to free the tiles for reallocation to other prefix base width. This may improve the overall utilization of the pivot tiles, preventing over or under population of prefixes within the tiles and improving the speed of route lookup from the table. In still other implementations, prefixes or pivots may be relocated to other possible pivot tiles or to a general storage space when a hash collision is detected. This provides for even distribution of pivots within tiles which have base widths in range of a pivot route. The above implementations may occur together or separately to improve the operation of the networking device and provide faster route lookup.

Networking devices may utilize many types of tables, circuits, and programs to determine how a received packet is to be routed. One particular embodiment may utilize an Application Specific Integrated Circuit (ASIC) to provide a forwarding pipeline for the networking device to support various forwarding scales depending on the position of a forwarding device (e.g., switch) in a network. In conventional ASICs, templates generally are defined to accommodate prefix scale. However, if prefix base widths are statically set on memory tiles, the tiles may need to be reconfigured to account for changes in routes in the network received at the network device.

Implementations of software algorithms and hardware architectures of ASICs to efficiently store address prefix tables in memory and process lookups at a very high speed in a networking device are discussed below. In one or more embodiments, a software algorithm works in tandem with hardware capabilities in a dynamic manner to accommodate varying route profiles. As described in detail below, one or more embodiments may dynamically store prefixes in a memory tile (e.g., pivot tile), providing increased flexibility for the hardware.

Beginning with reference to FIG. 1, an example of a network in which embodiments described herein may be implemented is shown. For simplification, only a small number of nodes of the network environment 100 are shown. The network environment 100 includes a data communication network 102 or other type of computing network. The network 102 may include any number of network devices, such as network device 108 and network device 110, in communication via any number of nodes. Network devices 108, 110 or nodes may be any type of network device, such as but not limited to, routers, switches, gateways, controllers, edge devices, access devices, aggregation devices, core nodes, intermediate nodes, or other network devices. Through the communication between the devices, data or communication packets may be passed or transmitted within the network. The network devices 108, 110 may communicate over one or more networks (e.g., local area network (LAN), metropolitan area network (MAN), wide area network (WAN), virtual private network (VPN), virtual local area network (VLAN), wireless network, enterprise network, corporate network, data center, Internet, intranet, radio access network, public switched network, or any other network).

In the simplified example shown in FIG. 1, a source device 104 is in communication with destination device 106 over network 102. The network path shown between the source device 104 and destination device 106 includes two network devices (forwarding devices), network devices 108, and 110. Although only two network devices 108, 110 are illustrated, it should be appreciated that any number of devices may be included in the network 102. In general, the network devices 108, 110 may include switches, routers, switches/routers, or other network devices comprising network routing or switching elements configured to perform forwarding functions. The network 102 may also include any number of sources, destinations, and intermediate nodes to facilitate the exchange of data and/or communication packets between source device 104 and destination device 106.

Packets originating from the source device 104 are typically forwarded over the network 102 through selected network devices 108, 110 to the destination device 106. Each network device 108, 110 may maintain a forwarding table and next-hop table in an ASIC configuration or other integrated circuit device, although any storage medium for maintaining the forwarding table may be utilized. The forwarding table generally contains IP (Internet Protocol) addresses (e.g., IPv4, IPv6) of other nodes on the network, whereas the next-hop table contains addresses of directly coupled neighboring nodes. Each IP address in the forwarding table is associated with one or more next-hop addresses in the next-hop table.

When a packet is received at the network device 108, a destination IP address may be obtained from the received packet and compared to one or more memory tiles stored in the ASIC, as described in more detail below. In case of multiple matches of the destination IP address, longest matching prefix information is typically used. In one embodiment, a combination of hash lookup and trie lookup may be used to find the longest prefix match utilizing memory tiles.

In one particular implementation, the network device 108 shown in FIG. 1 includes a route lookup module 112. The route lookup module 112 may identify host routes or longest prefix match routes, for example. In one embodiment, the route lookup module 112 comprises one or more of a dynamic trie 114 routing table (e.g., software, firmware, code, logic, hardware) operable to store address prefixes and next-hop information for use in a lookup performed for forwarding packets from the source device 104 to destination device 106. In general, the trie is an ordered tree structure for storing a dynamic or associative array of data, such as a routing address prefix. In this implementation, the dynamic trie 114 may include one or more software algorithms (e.g., logic, code) and hardware architecture (e.g., memory tiles stored in ASIC) for configuring a device for storing varying route profiles. A lookup may be performed, for example, for a destination IP address contained in a packet received at network device 108 for a next-hop IP address of network device 110. Network device 110 may also comprise a route lookup module similar to route lookup module 112 for additional routing of a received packet based on routing information received at the network device. Prefixes and next-hop information may be stored on any number of memory tiles such as one or more pivot tiles, trie tiles, and next-hop tiles.

The term “memory tile” or “tile” as used herein refers to any table or data structure or portion, section, or group of memory on an ASIC or other memory device for storing parts of a lookup table including entries associated with routes, addresses, adjacency information, and the like. More specifically, the terms “pivot tile”, “trie tile”, and “next-hop tile” as used herein refer to a portion of memory reserved for storing specific types of entries (e.g., covering prefix (pivot), trie indices, and adjacency indices).

As described below, the term “pivot” as used herein refers to a covering prefix (e.g., parent prefix (node) or root of subtree, address (prefix) that covers or includes other addresses (prefixes)). The term “prefix” as used herein refers to a network or route prefix. The term “base-width” as used herein refers to a prefix (or pivot) length (bit-length of prefix) and may be associated with a mask. The prefix may be associated with an IPv4 (Internet Protocol version 4) or IPv6 (Internet Protocol version 6) address, for example.

Turning now to FIG. 2, a schematic diagram of one or more pivot tiles 202, trie tiles 204, and next-hop tiles 206 (also referred to as a forwarding pipeline) for use in performing a route lookup of a networking device. In one particular implementation, the forwarding pipeline 200 is embodied on an ASIC of the networking device and may be split into stages. A route lookup table may be broken up into the tiles 202-206 and may be allocated to a specific forwarding entry type (e.g., IP LPM (IPv4, IPv6), ECMP, and Adjacency). Each tile 202-206 of the chain may thus store the prefixes of a certain range of prefix lengths. In a first stage, prefixes may be compressed and stored with a covering prefix (referred to herein as a pivot) on a pivot tile 202. The pivot tile 202 stores pivot entries corresponding to one or more prefix entries associated with an IP address. A pivot entry comprises a covering prefix (pivot) 208, sub-tree members 210, which may be enumerated as individual bits in a bitmap based on position, and one or more pointers 212 to an index in a second stage 204. The second stage tile may be referred to as a trie index or trie tile 204. One or more pivot values may be selected to divide prefixes evenly into groups. The tree bitmap contains a bitmap of the sub-trie and a pointer for next-hop, and a bitmap for a head pointer to a block of child nodes (routes) 216 on the trie tile 204.

In the second stage 204, the prefixes that are present in the sub-tree have their net-hop pointers enumerated with the trie index as the base offset. The trie tile 204 stores child route information of the prefix entries in the pivot tile. The second stage may include pointers 216 to adjacency indices that contain rewrite information (e.g., information A, information B, information C, information D, information E, etc.) in a third stage (referred to as a next-hop tile) 206. The next-hop tile 206 stores adjacency (next-hop) information.

In one embodiment, the number of pivots that are needed on the pivot tiles 202 are optimized based on a traffic profile and typically include prefixes of a particular mask length (M). In another embodiment, compressed logic may be used for next-hop sharing so that multiple pivots may point to the same row comprising next-hop information on the trie tile (referred to herein as compressed trie). Further, one or more prefixes may be stored in a TCAM (Ternary Content-Addressable Memory) and then moved to the pivot tile 202 when a utilization threshold has been reached at the TCAM.

FIG. 3 is a flowchart illustrating an overview of a process for storing route information in a dynamic trie, in accordance with one embodiment. In operation 302, prefixes corresponding to routes in the network are received at a network device (e.g., networking device 108 in FIG. 1). In one example, a request may be received to add a prefix to memory for a route lookup at the forwarding device. As described above with respect to FIG. 2, the memory may include a plurality of memory tiles for storing pivot entries, a trie index, and a next-hop index. Prefixes are dynamically selected for efficient storage in the pivot tiles 202 by searching a dynamic pool of pivot tiles 202 for an available pivot tile based on a base-width in operation 304. If a pivot tile is available based on a search of the dynamic pool of pivot tiles 202, a tile (or at least a portion of the pivot tile) may be allocated for the base-width in operation 306. A pivot entry is created on the available pivot tile for the prefix and other prefixes with a corresponding mask (base-width) based on a hashing function described in more detail below. In one embodiment, elements in TCAM with a corresponding base-width may also be moved onto the allocated pivot tile. Further, the prefixes stored on the pivot tile may be dynamically updated based on route changes to optimize storage on the pivot tile 202 in operation 308. For example, new prefixes may be added to the pivot tile or prefixes may be deleted from the pivot tile if no longer needed. Memory (pivot tiles) may therefore be adjusted for varying route profiles.

In one embodiment, once a base-width is set on a tile, the pivots of only that mask length are available for programming onto that pivot tile. Thus, when there is T such tiles (e.g., T equal to 8, 12, or any other number depending on the layout) allocated, there is a limited number of pivot tiles. Given the prefix distribution, a challenge is to fit in the maximum number of pivots, given the minimal number of hash collisions.

In some implementations, a small scratchpad TCAM (Ternary Content-Addressable Memory) may be used to aid the networking device in maintaining some received prefixes until a TCAM threshold of similar prefixes (based on base-widths) is reached on a per prefix length. When this threshold is reached for prefixes of a given prefix-length in TCAM, migration to pivot tiles may take place. Additionally, a pivot may cover prefixes that are three additional levels deep in the hardware to allow more prefixes to be stored within the pivot.

FIG. 4 is a flowchart of a method 400 for adding a prefix in a dynamic trie structure of a networking device. As previously described, one or more dynamic trie embodiments allow pivot tile base-widths to be chosen dynamically when prefixes are learned and TCAM thresholds are reached for each prefix length (if TCAMs are used for storage). Beginning at operation 402, a request for adding a prefix/mask (P/M) is received at a networking device. The possible tiles that the mask (M) can get into are identified in operation 404. In one pivot tile configuration, a pivot covers prefixes that are three additional levels deep in the hardware. Thus, the prefix with mask (M) may potentially get into tiles that have a base-width of M−3, M−2, M−1, or M (preferably in that order). Different depth levels may be used in some instances such that the base-width may be M−K, where K is the depth of the hardware lookup available for a specific address family.

If pivot tiles are available, the prefix (prefix/mask) may be stored into the available tile in operation 407. If no tiles are available or there is no space in the dynamic pool of pivot tiles in operation 406, or if the specified TCAM threshold for the mask length M has not been reached in operation 408, the prefix (prefix/mask) is placed into TCAM in operation 410. However, if the TCAM threshold has been reached and/or if a tile exists in the dynamic pool of pivot tiles (i.e., pivot tile is free and not yet associated with any base-width), the pivot tile is allocated in operation 412 with the base as (M−3) (or placed in one of the tiles with ordered preference of tile with base-width M−3, M−2, M−1). For IPv6 prefixes, the lowest depth for a pivot route may be M−4. Further, elements (or prefixes) in TCAM with mask M (same base-width) or up to M−3 may then be moved into the pivot tile provided hash collisions do not occur in operation 410.

Once one or more pivot tiles 202 are allocated, similar route prefixes received at the networking device may be included in the pivots if the base width is at least M−3 of the allocated tile. For example, through the above method 400, a new tile created for /24 v4 prefixes has a (24−3)=21 base width. Similarly, a new tile created for /64 V6 prefix has a (64−4)=60 base width. Thus, maximum trie utilization occurs when prefixes are inserted from highest to lowest prefix length order. Sub-optimal trie utilization, on the other hand, is observed when prefixes are inserted from lowest to highest prefix length order. However, because the order in which route prefixes are received at the networking device and inserted into the allocated pivots is not controlled by the device but rather occurs as routes are received, achieving optimal trie utilization becomes difficult. Moreover, the same pivot tile may be shared by both v4 prefixes and v6 prefixes such that utilization may vary widely when the set of v4 and v6 prefixes are inserted as received. Thus, methods and systems for improving the utilization of trie tiles 202 in the networking device are now described.

As mentioned above, the ASIC or networking device may utilize a hash function to determine a location within a particular pivot tile for storing a received prefix. In general, the networking device applies a hash function to some aspects of the received prefix to determine a location in the pivot tile memory at which the prefix is stored. In some implementations, the ASIC may utilize four different hash functions and each pivot tile is assigned or associated with one of the four hash functions. Thus, a hash location of the same prefix can vary depending on the selected hash type. In the case of a v6 prefix that spans two pivot tiles, the hash function associated with the first pivot tile (referred to herein as the left tile) of the prefix span is used to determine the location within the pivot tile for the v6 prefix.

When a prefix is installed in a pivot tile, the networking device executes a lookup in the pivot tile at a location determined by the hash function. In one implementation, the hash function takes as inputs the prefix virtual routing and forwarding information, IP address, and the prefix length, although any aspect of the prefix may be used as an input to the hash function for the particular pivot tile. As should be appreciated, hash types within the same base width tiles should be distributed evenly to achieve the best hash utilization. However, because multiple address families (v4 and v6) can share the same pivot tile and prefixes are generally learned in the order received, some dynamic hash type selection for pivot tiles may improve the overall efficiency of the networking device route lookup.

FIG. 5 is a flowchart of a method 500 for dynamic hash allocation of pivot tiles for efficient hash utilization in a network device. Through the method, the hash location of the same prefix can vary dependent on the selected hash type for the pivot tile selected for the prefix. In general, the method 500 is executed by the networking device when either a new pivot tile is created or an already allocated tile is shared with another address family.

An example configuration of pivot tiles is provided below in table 1:

TABLE 1 # of v4 Prefixes/ # of v6 Prefixes/ Tile ID Hash Function Base Widths Base Widths 0 0 130/21 0/0 1 1 150/21 0/0 2 2 100/21 0/0 3 3  90/21 0/0 4 2 170/21 0/0 5 0 110/21 0/0 Assume that the networking device has a maximum of eight pivot tiles. The allocation of hash functions for pivot tiles 0-5 in Table 1 may occur through the dynamic hash allocation method 500 described herein or may just occur through any other formula executed by the networking device.

Beginning in operation 502 of the method 500 of FIG. 5, the networking device receives a route prefix to be located in a pivot tile. The received prefix may initiate the creation of new pivot tile or another address family is to be shared with an existing tile. Thus, the networking device generates a request to create a new tile of a specific base width or an address family. Beginning in operation 504, the networking device determines if a new tile is to be created for the received prefix and begins sorting through already created tiles (such as pivot tiles 0-5 above) to determine if tiles with the requested base width is already created. If the networking device determines that a pivot tile with the base width of the received prefix already exists, the device determines in operation 506 if any hash values associated with the identified tiles of the requested base width are evenly distributed.

Using the example of Table 1 as an example, all of the created tiles have a base width of /21 and assume the received prefix to be included in a tile also has a base width of /21. The networking device may determine that tiles 0-5 have the same base width (/21) as the requested prefix (/21) and determine the allocated hash values for each identified tiles. In this example, hash function 0 and hash function 2 are allocated twice, with hash function 1 and hash function 3 allocated once. As such, the device may determine that no single hash function is least allocated among the pivot tiles with the same base width as the requested prefix.

If the networking device determines that hash functions for the tiles with the same base width are not evenly distributed, the networking device may select the hash function that is least allocated for the identified pivot tiles and allocate that hash function for the tile to be created in operation 508. Selecting the least allocated hash function to the newly created pivot tile reduces the likelihood that a hash collision occurs for the prefix when being stored in a location of the pivot tile. Alternatively, if the network device determines that the hash function for the tiles with the same base width are evenly distributed, the networking device may select a hash function with the highest hash utilization for the created tile or requested address family in operation 510. For example and using the pivot tiles of Table 1, the networking device determines that hash function 0 and hash function 2 are allocated twice for /21 base widths, with hash function 1 and hash function 3 allocated once. Thus, allocating hash function 1 or hash function 3 for a newly created pivot tile with base width /21 provides the highest hash utilization for the group of pivot tiles. In other words, the networking device may select the hash functions that are least allocated in a way to maximize the hash utilization for the group of pivot tiles with the same base width.

A similar process as described above may be executed for v6 pivots to be included in the pivot tiles. For example, if the newly created tile is to be a left tile allocated from a dynamic pool, then the above operations are performed to select the hash function that is the least allocated amount allocated left tiles. For example, take the circumstance illustrated in Table 1 where the ASIC may include eight pivot tiles. If a v6 pivot (such as a v6 /60 pivot) is received and to be included in pivot tiles, the networking device may create two new pivot tiles for the v6 /60 pivot. In addition, the hash function selected for the left /60 pivot tiles may be determined through the operations described above (i.e., hash function 3 or hash function 1). Thus, application of the method 500 to the allocated pivot tiles may yield the following hash function distribution:

TABLE 2 # of v4 Prefixes/ # of v6 Prefixes/ Tile ID Hash Function Base Widths Base Widths 0 0 130/21 0/0 1 1 150/21 0/0 2 2 100/21 0/0 3 3  90/21 0/0 4 2 170/21 0/0 5 0 110/21 0/0 6 3  0/0 210/60  7 1  0/0 210/60  In instances where the newly created tile is a right tile for the v6 prefix, the allocated hash function may from a pre-defined hash mapping table (i.e., left hash function 0 maps to a right hash function of 2).

Returning to the method 500 of FIG. 5, the networking device may determine if the requested tile is to be allocated from a shared pool of pivot tiles in operation 512. If a pivot tile from the shared pool is sought, the networking device may return to operations 506-510 to determine an allocated hash function associated with the received pivot in operation 524. For example, returning to the hash function distribution of Table 1, assume that a pivot of v4 /21 is received. In such a case, the operations above may return hash function 3 or hash function 1 for use in storing the v4 /21 pivot (based on highest hash utilization for the given base width /21). With the returned hash function, the networking device may search the existing pivot tiles for a pivot tile with that same hash function in operation 516. In operation 518, the networking device determines if a pivot tile with the returned hash type and the base width exists. If such a tile exists, the networking device attempts to store the prefix in the selected pivot tile in operation 522. If no pivot tile is found with the returned hash function, the networking device may select a pivot tile from the bottom of the shared pool and use the hash function for that tile for the requested pivot in operation 520.

In some instances, a pivot tile from the shared pool does not have the same base width as the received prefix as determined in operation 512. In this circumstance, the networking device may continue to operation 514 and obtain a unique hash function from a defined formula of the ASIC. Once the unique hash function is returned, the networking device continues to operations 516-522 to select a pivot tile from shared pool of pivot tiles.

The method 500 of FIG. 5 attempts to provide an even distribution of hash functions for a requested base width. It also attempts to create hash functions in a specific order irrespective of the order of prefix insertion into the trie route table. For example, FIG. 6 illustrates the application of the dynamic hash allocation method in a plurality of pivot tiles of a networking device. As shown in the “before” side 602 of the illustration (showing an example hash function distribution without using the method 500 above), pivot tiles with the same base width may be allocated the same hash function (such as pivot tiles with base width v4/v6: 13/60 each being allocated hash function 0). With each pivot tile for the same base width having the same hash function, the possibility of a hash collision occurring within those pivot tiles for newly added pivots increases. After application of the hash function distribution algorithm discussed above (illustrated in the after side 604 of the FIG. 6), pivot tiles with shared base width v4/v6: 13/60 now have varying hash functions (hash function 0, hash function 1, and hash function 2) allocated for the pivot tiles. This reduces the possibility of hash collisions when pivots are added to one or more of these tiles, thereby improving the efficiency of the networking device trie routing table and system.

The networking device may employ other methods and/or systems to improve the efficiency of the trie routing table and system. For example, FIG. 7 is a flowchart of a method 700 for regrouping pivot tiles of a network device to free up one or more tiles in a networking device for adding more pivots to the pivot tiles. The operations of the method 700 may be performed by the networking device in addition to or separate from the hash function distribution discussed above. Through the method 700, a more efficient use of the available pivot tiles may be achieved in an attempt to maximize the memory use of the ASIC associated with the trie routing table.

In one implementation, the networking device may be configured to begin grooming upon the occurrence of a device event (such as a hash collision, a notification of a maximum pivot tile usage, a scheduled time for grooming, etc.). In another implementation, the networking device may be configured to receive one or more instructions from a device operator to trigger regrooming of the pivot tiles. These instructions may be provided in response to an alarm in the device or from one or more status reports provided to the operator. In still other implementations, pivot tile regrooming may occur periodically as determined by a device operator.

In one particular instance, a prefix/mask of a route is received at the networking device for inclusion in the trie routing table. The prefix may initially be stored in TCAM or similar scratchpad program. However, assume that the TCAM threshold has been met and no tiles exist in the dynamic/shared pool to allocate to the prefix. In such as circumstance, the device may try to free TCAM space by moving routes from the TCAM to one or more pivot tiles. However, if the TCAM threshold is still exceeded, the networking device may trigger the regrooming method 700 of FIG. 7 to try and achieve optimal usage of pivot tiles.

Beginning in operation 702, the networking device may select a tile for grooming or regrouping. In one implementation, the networking device may apply one or more filters to order the pivot tiles in a particular order prior to tile selection. For example, the tiles may be ordered from lower to higher trie utilization or the number of pivot loops of the tile. Regardless, once a tile is selected, the device determines if all of the routes in the selected tile can be moved to TCAM. If all of the routes in the selected pivot tile can be moved to TCAM, the device moves the routes accordingly and returns the tile to the dynamic/shared tile pool in operation 706. This frees the tile for allocation to other prefix/maps as other prefixes are received.

If not all of the routes can be moved to TCAM, the device may attempt to move routes of the selected tile to other allocated tiles in operation 708. For example, consider the pivot tile allocation scenarios illustrated in FIG. 8. Beginning with scenario 802, assume that the routes 1-7 are received at the networking device in the order shown 804. As the routes are allocated to pivot tiles 806 in the order received and based on a mask length (M−3 in particular), all six pivot tiles are allocated with varying base widths. In particular, route 1 has a mask length of /21 such that pivot tile 0 is created with a base width of /18 (M−3). Then route 2 with a mask length of /22 is received at the networking device. Because /22 cannot be included in pivot tile 0 because the base width of tile 0 is more than M−3, a new pivot tile (pivot tile 1) is created for route 2. This process continues through the received routes 804 until pivot tiles 0-5 806 are allocated. However, route 7, when received, cannot be included in any created pivot tile as route 7 has a mask length of /27 (for base widths M−3 to M, i.e., /24 to /27), which does not qualify for any created pivot tile. In one implementation, this inefficiency in the trie route system may trigger the grooming process 700 of FIG. 7.

Consider an alternate inefficiency illustrated in scenario 808 of FIG. 8. In this example, route 1 of mask length /27 is received such that pivot tile 0 is created with base width /24. In this example, routes 2-4 may also be included in pivot tile 0. Route 4 may then be received for which pivot tile 3 is created with base width /20. Routes 5-7 may also be included in pivot tile 1. However, this leaves pivot tiles 2-5 812 empty. In this scenario 808, the pivot tiles 812 are not used efficiently by the system as an efficient system would utilize all pivot tile space. The grooming method 700 discussed above may further improve the efficient use of the pivot tile usage of the system.

A more efficient use of the pivot tiles may include a grooming method such all pivot tiles are utilized while freeing up tiles when new prefixes cannot be included in the existing pivot tiles. For example, consider scenario 814 of FIG. 8. Similar to scenario 802, pivot tiles 1-5 are created and populated as prefixes are received such that routes 1-6 816 are included in pivot tiles. Route 7 of scenario 814 is received with a mask length of /27, which cannot be included in any created tiles, also similar to scenario 802. However, in this example, the pivot tiles may be groomed so that stored pivots may be moved to TCAM or another pivot tile. In particular, received route 1 has a mask length of /21 which led to the creation of pivot tile 0 with a base width /18. However, route 1 may also be stored in pivot tile 1 as the base width of pivot tile 1 (/19) allows for storage of /21 routes (M−2). Thus, route 1 may be moved to pivot tile 1 through the method 700 described herein, which frees up pivot tile 0 to be reallocated with a base width of /24 for storage of received route 7. Through the grooming process described herein, pivot tiles may be used efficiently for the received routes.

Returning to the method 700 of FIG. 7, the networking device first attempts to move all pivots of a tile to TCAM and, if all of the pivots of a selected tile cannot be moved, attempts to move pivots of the selected tile to other allocated tiles in operation 708. Similar to scenario 814 described above, pivots may be placed in any pivot tiles with a base width of M−3, M−2, M−1, or M for the pivot, with preference given in that order. Thus, route 1 of scenario 814 may be relocated to pivot tile 1, pivot tile 2, or pivot tile 3. Moving a pivot from the selected tile to another allocated tile may be done in a manner as described above, such as by calculating a location within the pivot tile from one or more hash functions and storing the pivot in the tile if a hash collision does not occur.

In operation 710, the networking device determines if all of the routes in the selected tile have been moved to other tiles. If all of the routes of the selected pivot tile can be moved to other tiles, the tile may then be considered free and returned to the dynamic/shared pool of tiles in operation 712. If, however, routes remain in the selected tile after moving routes to other tiles, the networking device may determine if the remaining routes from the selected pivot tile can be moved to TCAM in operation 714 and return to operation 706 to move the remaining routes to TCAM. This frees up the tile to be returned to the dynamic/shared pool of tiles. If the tile cannot be freed of all routes, the networking device may return to operation 702 to select the next tile in the sorted list and attempt to free up the next tile for use by the networking device.

In some instances, the above method 700 may not free up a pivot tile for use by other received routes. In such cases, the networking device may keep inserting routes into TCAM until free space is available for a respective address family. Further, the networking device may track the result of the grooming process, including the number of pivots deleted after the failed grooming attempt. The grooming process may not be attempted again on the pivot tiles until a sufficient number of pivots are deleted from the tiles. When a tile is freed, the device may then move the oldest or the route with the highest weight (based on prefix length) from the TCAM to the trie storage structure.

In addition to or as part of the dynamic hash distribution and pivot tile grooming methods discussed above, the networking device may also execute a pivot relocation process to further improve the efficiency of the pivot tile use by the networking device. In particular, FIGS. 9A and 9B illustrate a flowchart of a method 900 for relocating prefixes when a hash collision occurs within the pivot tile of the networking device. Through the method 900, the networking device may attempt to relocate prefixes from a tile to an allocated pivot tile upon the occurrence of a hash collision. In other words, the device may relocate a pivot to another tile so that a received prefix may be stored in a pivot tile at the same location. This makes space for other prefixes primarily from different address families and allows even distribution of pivots within tiles which have a base width in a range of depth of a pivot route.

Consider a circumstance where v4 routes are inserted into pivot tiles before v6 routes. The v4 routes are allocated to the pivot tiles following the rules for prefix insertion such that some v4 routes may have already taken up a location (as determined by the tiles hash function) that may be the same location for a v6 route. For example, when v6 routes are moved from TCAM to the pivot tile, a hash collision may occur with a v4 route programmed into the tile at the same location. However, by relocating the v4 pivot and associated routes to another allocated tile, space may be freed up at the location for the v6 route, aiding in optimizing pivot distribution for a given set of prefixes irrespective of prefix insertion order.

In general, the method 900 of FIGS. 9A and 9B may be triggered or executed by the networking device when routes are moved from TCAM to a pivot tile or when freeing up tiles as part of the pivot grooming process described above with relation to FIG. 7. Further, the pivots may be relocated to tiles associated with the hash function selected through dynamic hash selection process discussed above with relation to FIG. 5. The probability of even pivot distribution within the same base width tile increases when hash functions are evenly distributed. In this manner, the method 900 may be utilized in tandem with other efficiency methods described herein.

Beginning in operation 902 (and similar to method 400 of FIG. 4), the networking device receives a request to add a prefix/mask to a trie routing table and determines the possible, if any, pivot tiles that the prefix can fit into (i.e., pivot tiles with a base width of M−3, M−2, M−1, or M) selected in that order for maximum occupancy in operation 904. If no pivot tiles qualify for the received prefix, the networking device determines if the TCAM threshold for the mask is reached in operation 908 and, if not, the prefix is stored in the TCAM in operation 910. If the TCAM threshold is reached, the networking device may allocate a tile for the prefix (assuming that the dynamic or shared pool of tiles includes a free tile not yet associated to any base width of the prefix address family) with a base width of M−3. In operation 914, the networking device attempts to move all prefixes in the TCAM with mask M into the created tile, potentially repeating the above operations to find space in the pivot tiles for the prefixes moving from the TCAM.

In some instances, a hash collision indicating that no free space is available in the pivot tiles for a given prefix may occur as prefixes are moved from TCAM to the pivot tiles. In such instances, the method 900 may be continued as illustrated in FIG. 9B. In particular, the networking device, upon a hash collision, may calculate possible hash locations for the prefix in the pivot tiles identified above (i.e., pivot tiles with a base width of M−3, M−2, M−1, or M) in operation 916. As mentioned, each pivot tile may have a corresponding hash function that is used to determine locations within the tile for storing a prefix. Therefore, a given prefix may be stored in multiple pivot tiles at the calculated hash locations within the tiles.

With the possible hash locations determined, the networking device may pick a pivot from a tile that is occupying a hash location that is the same as the possible hash location for the prefix moving from the TCAM and attempt to relocate the entire pivot (along with its children) to another pivot tile in operation 920, removing the current pivot tile from the list of possible pivot tiles for relocating the occupying pivot. For example, the pivot may be moved to another pivot tile with base widths M−3, M−2, M−1, or M for the pivot. If the move of the pivot is successful as determined in operation 922, the networking device may move the prefix from the TCAM to the vacated hash location in the pivot tile in operation 926. If the occupying pivot cannot be relocated to another pivot tile, the networking device may determine if the occupying pivot can be moved to TCAM dedicated for the respective address family in operation 924. If the occupying pivot can be moved to TCAM, the networking device does so in operation 928 and moves the prefix to the vacated hash location in the pivot tile in operation 926. If the occupying pivot cannot be moved to TCAM, the network device may return to operation 918 and select another potential hash location in a pivot tile and repeat the resulting operations of the method 900. In some instances, no potential hash location for the moving prefix may be identified. In such cases, the prefix is kept in its original location.

Through the method 900 of FIGS. 9A and 9B, pivots of one or more pivot tiles may be relocated to free up a location for storing other prefixes. This may provide for a maximum occupancy for the pivot tiles of the trie routing table of the networking device. Further, the relocation process may be executed in conjunction with the grooming process described above to free up pivot tiles for re-allocation. Further, because the pivot tiles may be assigned hash functions through a dynamic hash allocation process, the likelihood of hash collisions occurring when inserting a prefix or moving a pivot from one tile to another may be reduced. As such, the processes and systems described herein may improve the operational efficiency of the trie routing table of the networking device.

FIG. 10 shows an example of computing system 1000 which may be utilized in conjunction with the herein described systems and methods. In particular, the computing system 1000 is an example of the networking device 102 of the environment 100 described above. In the embodiment shown, the components of the system are in communication with each other using connection 1005. In general, connection 1005 can be a physical connection via a bus, or a direct connection into processor 1010, such as in a chipset architecture. Connection 1005 can also be a virtual connection, networked connection, or logical connection.

In some embodiments, computing system 1000 is a distributed system in which the functions described in this disclosure can be distributed within a datacenter, multiple datacenters, a peer network, etc. In some embodiments, one or more of the described system components represents many such components, each performing some or all of the function for which the component is described. In some embodiments, the components can be physical or virtual devices.

Example system 1000 includes at least one processing unit (CPU or processor) 1010 and connection 1005 that couples various system components, including system memory 1015, such as read only memory (ROM) 1020 and random access memory (RAM) 1025, to processor 1010. Computing system 1000 can include a cache of high-speed memory connected directly with, in close proximity to, or integrated as part of processor 1010.

Processor 1010 can include any general purpose processor and a hardware service or software service, such as services 1032, 1034, and 1036 stored in storage device 1030, configured to control processor 1010 as well as a special-purpose processor where software instructions are incorporated into the actual processor design. Processor 1010 may essentially be a completely self-contained computing system, containing multiple cores or processors, a bus, memory controller, cache, etc. A multi-core processor may be symmetric or asymmetric.

To enable user interaction, computing system 1000 includes an input device 1045, which can represent any number of input mechanisms, such as a microphone for speech, a touch-sensitive screen for gesture or graphical input, keyboard, mouse, motion input, speech, etc. Computing system 1000 can also include output device 1035, which can be one or more of a number of output mechanisms known to those of skill in the art. In some instances, multimodal systems can enable a user to provide multiple types of input/output to communicate with computing system 1000. Computing system 1000 can include communications interface 1040, which can generally govern and manage the user input and system output. There is no restriction on operating on any particular hardware arrangement and therefore the basic features here may easily be substituted for improved hardware or firmware arrangements as they are developed.

Storage device 1030 can be a non-volatile memory device and can be a hard disk or other types of computer readable media which can store data that are accessible by a computer, such as magnetic cassettes, flash memory cards, solid state memory devices, digital versatile disks, cartridges, random access memories (RAMs), read only memory (ROM), and/or some combination of these devices.

The storage device 1030 can include software services, servers, services, etc., that when the code that defines such software is executed by the processor 1010, it causes the system to perform a function. In some embodiments, a hardware service that performs a particular function can include the software component stored in a computer-readable medium in connection with the necessary hardware components, such as processor 1010, connection 1005, output device 1035, etc., to carry out the function.

For clarity of explanation, in some instances the present technology may be presented as including individual functional blocks including functional blocks comprising devices, device components, steps or routines in a method embodied in software, or combinations of hardware and software.

Any of the steps, operations, functions, or processes described herein may be performed or implemented by a combination of hardware and software services or services, alone or in combination with other devices. In some embodiments, a service can be software that resides in memory of a portable device and/or one or more servers of a content management system and perform one or more functions when a processor executes the software associated with the service. In some embodiments, a service is a program, or a collection of programs that carry out a specific function. In some embodiments, a service can be considered a server. The memory can be a non-transitory computer-readable medium.

In some embodiments the computer-readable storage devices, mediums, and memories can include a cable or wireless signal containing a bit stream and the like. However, when mentioned, non-transitory computer-readable storage media expressly exclude media such as energy, carrier signals, electromagnetic waves, and signals per se.

Methods according to the above-described examples can be implemented using computer-executable instructions that are stored or otherwise available from computer readable media. Such instructions can comprise, for example, instructions and data which cause or otherwise configure a general purpose computer, special purpose computer, or special purpose processing device to perform a certain function or group of functions. Portions of computer resources used can be accessible over a network. The computer executable instructions may be, for example, binaries, intermediate format instructions such as assembly language, firmware, or source code. Examples of computer-readable media that may be used to store instructions, information used, and/or information created during methods according to described examples include magnetic or optical disks, solid state memory devices, flash memory, USB devices provided with non-volatile memory, networked storage devices, and so on.

Devices implementing methods according to these disclosures can comprise hardware, firmware and/or software, and can take any of a variety of form factors. Typical examples of such form factors include servers, laptops, smart phones, small form factor personal computers, personal digital assistants, and so on. Functionality described herein also can be embodied in peripherals or add-in cards. Such functionality can also be implemented on a circuit board among different chips or different processes executing in a single device, by way of further example.

The instructions, media for conveying such instructions, computing resources for executing them, and other structures for supporting such computing resources are means for providing the functions described in these disclosures.

Although a variety of examples and other information was used to explain aspects within the scope of the appended claims, no limitation of the claims should be implied based on particular features or arrangements in such examples, as one of ordinary skill would be able to use these examples to derive a wide variety of implementations. Further and although some subject matter may have been described in language specific to examples of structural features and/or method steps, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to these described features or acts. For example, such functionality can be distributed differently or performed in components other than those identified herein. Rather, the described features and steps are disclosed as examples of components of systems and methods within the scope of the appended claims. 

1. A method for managing a routing table of a networking device, the method comprising: maintaining a plurality of pivot tiles in memory for storing pivot entries each comprising a plurality of received route prefixes of a routing table, each of the plurality of pivot tiles associated with a hash function and a prefix base width; selecting a first of the plurality of pivot tiles for grooming, wherein grooming of the first of the plurality of pivot tiles comprises: relocating at least a first pivot entry from the first of the plurality of pivot tiles to a Ternary Content-Addressable Memory (TCAM); moving at least a second pivot entry from the first of the plurality of pivot tiles to a second of the plurality of pivot tiles; and returning the first of the plurality of pivot tiles to a shared pool of pivot tiles for reallocation when the plurality of received route prefixes of the routing table stored in the first of the plurality of pivot tiles are removed.
 2. The method of claim 1 further comprising: dynamically associating a first hash function with the first of the plurality of pivot tiles and a second hash function with the second of the plurality of pivot tiles, the first hash function different than the second hash function.
 3. The method of claim 2 wherein the first hash function provides a storage location within the first of the plurality of pivot tiles based at least on a portion of a prefix to be stored in the first of the plurality of pivot tiles.
 4. The method of claim 2 further comprising: selecting the first hash function for the first of the plurality of pivot tiles based at least on a distribution of each hash function for the plurality of pivot tiles.
 5. The method of claim 4 wherein selecting of the first hash function for the first of the plurality of pivot tiles is further based on a utilization factor for the distribution of each hash function for the plurality of pivot tiles.
 6. The method of claim 2 wherein moving the second pivot entry from the first of the plurality of pivot tiles to the second of the plurality of pivot tiles comprises calculating a location for the second pivot entry in the second of the plurality of the pivot tiles based on the second hash function associated with the second of the plurality of the pivot tiles.
 7. The method of claim 6 further comprising: detecting a hash collision at the location for the second pivot entry in the second of the plurality of the pivot tiles between the second pivot entry and an occupying pivot entry of the second of the plurality of the pivot tiles.
 8. The method of claim 7 further comprising: copying the occupying pivot entry of the second of the plurality of the pivot tiles to the TCAM; and relocating the second pivot entry to the location for the second pivot entry in the second of the plurality of the pivot tiles.
 9. The method of claim 7 further comprising: copying the occupying pivot entry of the second of the plurality of the pivot tiles to a third of the plurality of the pivot tiles; and relocating the second pivot entry to the location for the second pivot entry in the second of the plurality of the pivot tiles.
 10. The method of claim 1 wherein moving the second pivot entry from the first of the plurality of pivot tiles to the second of the plurality of pivot tiles is based at least on a base width of the second pivot entry and the second of the plurality of pivot tiles.
 11. A networking device comprising: at least one communication port for receiving route prefixes of a network for inclusion in a trie routing table; a processing device; and a computer-readable medium connected to the processing device configured to store a plurality of pivot tiles in memory for maintaining pivot entries each comprising a plurality of received route prefixes and associated with a hash function and a prefix base-width and instructions that, when executed by the processing device, performs the operations of: selecting a first of the plurality of pivot tiles for grooming, wherein grooming of the first of the plurality of pivot tiles comprises: relocating at least a first pivot entry from the first of the plurality of pivot tiles to a Ternary Content-Addressable Memory (TCAM); moving at least a second pivot entry from the first of the plurality of pivot tiles to a second of the plurality of pivot tiles; and returning the first of the plurality of pivot tiles to a shared pool of pivot tiles for reallocation when the plurality of received route prefixes of the routing table stored in the first of the plurality of pivot tiles are removed.
 12. The system of claim 10 wherein the instructions are further executed to: dynamically associate a first hash function with the first of the plurality of pivot tiles and a second hash function with the second of the plurality of pivot tiles, the first hash function different than the second hash function.
 13. The system of claim 12 wherein the first hash function provides a storage location within the first of the plurality of pivot tiles based at least on a portion of a prefix to be stored in the first of the plurality of pivot tiles.
 14. The system of claim 12 wherein the instructions are further executed to: select the first hash function for the first of the plurality of pivot tiles based at least on a distribution of each hash function for the plurality of pivot tiles.
 15. The system of claim 14 wherein selecting of the first hash function for the first of the plurality of pivot tiles is further based on a utilization factor for the distribution of each hash function for the plurality of pivot tiles.
 16. The system of claim 12 wherein moving the second pivot entry from the first of the plurality of pivot tiles to the second of the plurality of pivot tiles comprises calculating a location for the second pivot entry in the second of the plurality of the pivot tiles based on the second hash function associated with the second of the plurality of the pivot tiles.
 17. The system of claim 16 wherein the instructions are further executed to: detect a hash collision at the location for the second pivot entry in the second of the plurality of the pivot tiles between the second pivot entry and an occupying pivot entry of the second of the plurality of the pivot tiles.
 18. The system of claim 17 wherein the instructions are further executed to: copy the occupying pivot entry of the second of the plurality of the pivot tiles to the TCAM; and relocate the second pivot entry to the location for the second pivot entry in the second of the plurality of the pivot tiles.
 19. The system of claim 17 wherein the instructions are further executed to: copy the occupying pivot entry of the second of the plurality of the pivot tiles to a third of the plurality of the pivot tiles; and relocate the second pivot entry to the location for the second pivot entry in the second of the plurality of the pivot tiles.
 20. The system of claim 10 wherein moving the second pivot entry from the first of the plurality of pivot tiles to the second of the plurality of pivot tiles is based at least on a base width of the second pivot entry and the second of the plurality of pivot tiles. 